		<div class="main f_r">
            <div class='tabs'>
			<div class="uc_title m_10 tabs_menu">
				<label class="current node"><span>地址管理</span></label><label class="node" onclick='form_empty()'><span>添加地址</span></label>
			</div>
            <div class='tabs_content'>
                <div id="address_list" class="form_content m_10 node">
                    <div class="uc_title2 m_10"><strong>已保存的有效地址</strong></div>
                    <table  class="list_table" width="100%" cellpadding="0" cellspacing="0">
                        <col width="120px" />
                        <col width="120px" />
                        <col width="120px" />
                        <col width="120px" />
                        <col width="120px" />
                        <col />
                        <thead><tr><th>收货人</th><th>所在地区</th><th>街道地址</th><th>电话/手机</th><th>邮编</th><th>操作</th></tr></thead>
                        <tbody>
                        {foreach:items=$this->address}
                            <tr {if:$key%2==1}class='even'{/if}>
                                <td>{$item['accept_name']}</td><td id="sel{$item['id']}">{$this->areas[$item['province']]}{$this->areas[$item['city']]}{$this->areas[$item['area']]}</td><td>{$item['address']}</td><td>{$item['mobile']}</td><td>{$item['zip']}</td><td class="blue"><a class="blue" href='javascript:void(0)' onclick='form_back({echo:JSON::encode($item)})'>修改</a>|<a class="blue" href="javascript:void(0)" onclick="delModel({link:'{url:/ucenter/address_del/id/$item[id]}'});">删除</a>|{if:$item['default']==1}<a style="color:red" href="{url:/ucenter/address_default/id/$item[id]/default/0}" >取消默认</a>{else:}<a class="blue" href="{url:/ucenter/address_default/id/$item[id]/default/1}">设为默认</a>{/if}</a></td>
                            </tr>
                        {/foreach}
                        </tbody>

                    </table>
                </div>
            </div>
            </div>
			<div class="orange_box" id='address_form' >
			<form action='{url:/ucenter/address_edit}' method='post' name='form'>
				<table class="form_table" width="100%" cellpadding="0" cellspacing="0">
					<col width="120px" />
					<col />
					<caption>收货地址</caption>
					<tr>
						<th><span class="red">*</span> 收货人姓名：</th><td><input name='id' type='hidden' value=''><input name='accept_name' class="normal" pattern='required' alt='收货人不能为空' type="text" /><label>收货人真实姓名，方便快递公司联系。</label></td>
					</tr>
					<tr>
						<th><span class="red">*</span> 所在地区：</th><td><select id='province' name="province" onchange="select_city(this.value,2);">
							<option value="">请选择省份</option>
							{query: name=areas where=parent_id eq 0}<option value="{$item['area_id']}" >{$item['area_name']}</option>{/query}
							</select>
							<span id="selec2"></span><span id="selec3"></span></td>
					</tr>
					<tr>
						<th><span class="red">*</span> 街道地区：</th><td><input name='address' class="normal" pattern='required' alt='街道地区不能为空' type="text" /><label>真实详细收货地址，方便快递公司联系。</label></td>
					</tr>
					<tr>
						<th><span class="red">*</span> 邮政编码：</th>
						<td>
						<input name='zip' class="normal" pattern='^\d{6}$' alt='邮政编码格式不正确' type="text" /><label>邮政编码,如250000。</label>
						</td>
					</tr>
					<tr>
						<th><span class="red"></span> 电话号码：</th>
						<td>
						<input name='telphone' class="normal" pattern='phone' empty alt='电话号码格式不正确' type="text" /><label>电话号码,如010-12345688。</label>
						</td>
					</tr>
					<tr>
						<th><span class="red"></span> 手机号码：</th>
						<td><input name='mobile' class="normal" pattern='mobi' empty alt='手机号码格式不正确' type="text" /><label>手机号码，如：13588888888</label></td>
					</tr>
					<tr>
						<th><span class="red"></span> 设为默认：</th>
						<td>
						<label><input name='default' type='checkbox'  value='1'></label>
						</td>
					</tr>
					<tr><th></th><td><label class="btn_gray"><input type="submit" value="保存" /></label><a onclick="window.location.href='{url:/ucenter/address}'" ><label class="btn_gray"><input type="reset" value="取消" /></label></a></td></tr>
				</table>
				</form>
			</div>
		</div>
<script type='text/javascript'>
	//获得选中的地区名称
	function select_city(city,style,current)
	{
		var arr = city.split(',');
		$.getJSON("{url:/block/area_child}",{aid:arr[0]}, function(json)
		{
			if(style==2)
			{
				var select_html = '<select name="city" id="city" onchange="select_city(this.value,3);">';
				select_html += '<option value="">请选择城市</option>';
				for( a in json)
				{
					if(current == json[a]['area_id'])
						select_html +='<option value="'+json[a]['area_id']+'" selected="selected">'+json[a]['area_name']+'</option>';
					else
						select_html +='<option value="'+json[a]['area_id']+'">'+json[a]['area_name']+'</option>';
				}
				select_html +='</select>';
				$("#selec"+style).html(select_html);
			}
			if(style==3)
			{
				if(json.length>0)
				{
					var select_html = '<select name="area" id="area" onchange="select_city(this.value,4);">';
					select_html += '<option value="">请选择地区</option>';
					for( a in json)
					{
						if(current == json[a]['area_id'])
							select_html +='<option value="'+json[a]['area_id']+'" selected="selected">'+json[a]['area_name']+'</option>';
						else
							select_html +='<option value="'+json[a]['area_id']+'">'+json[a]['area_name']+'</option>';
					}
					select_html +='</select>';
					$("#selec"+style).show();
					$("#selec"+style).html(select_html);
				}
				else
				{
					//if($("#selec"+style).text()=='')
						$("#selec"+style).hide();
				}
			}
		});
	}
	function form_back(obj)
	{

		$('#address_list').css('display','none');
        //$('#address_form').css('display','none');
		var form = new Form('form');
        $('#address_form').slideDown("slow");
		form.init(obj);
		select_city(obj.province,2,obj.city);
		select_city(obj.city,3,obj.area);

	}
	function form_empty()
	{
		var form = new Form('form');
		form.init({"id":"","accept_name":"","zip":"","telphone":"","province":"","city":"","area":"","address":"","":"","default":""});
	}
</script>
